(function (global, factory) {
	typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
	typeof define === 'function' && define.amd ? define(factory) :
  // here name is your name
	(global.lrcFormater = factory());
}(this, (function () { 
    'use strict'
    return function(txt) {
        var oldArr = txt.split(/\n/g)
        var resArr = [] // last

        for (var i=0,item;item=oldArr[i++];)
        {
            if (item.match(/\[\d+:\d+\.\d+\]/g) === null) {
                continue
            }
            
            var numTag=item.match(/\[\d+:\d+\.\d+\]/g);
            // 匹配出数字标签
            for (var j=0,itemb;itemb=numTag[j++];)
            {
                var numArr = itemb.replace(/\[|\]/g, '').match(/\d+/g)
                var timeStamp = parseInt(numArr[0]) * 60 + parseInt(numArr[1]) + ((parseInt(numArr[2]) > 50) ? 1 : 0)
                resArr.push({
                    timeStamp: timeStamp,
                    txt: item.replace(/\[\d+:\d+\.\d+\]/g, '')
                })
            }
        }
    
        return resArr.sort(function(a, b){ 
            return a.timeStamp - b.timeStamp 
        })
    }

})))



